/*
 *
 *   Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
 *
 *   WSO2 Inc. licenses this file to you under the Apache License,
 *   Version 2.0 (the "License"); you may not use this file except
 *   in compliance with the License.
 *   You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing,
 *  software distributed under the License is distributed on an
 *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 *  KIND, either express or implied.  See the License for the
 *  specific language governing permissions and limitations
 *  under the License.
 *
 */

package org.wso2.carbon.apimgt.core.dao;

import org.wso2.carbon.apimgt.core.exception.APIMgtDAOException;
import org.wso2.carbon.apimgt.core.models.policy.ApplicationPolicy;
import org.wso2.carbon.apimgt.core.models.policy.Policy;
import org.wso2.carbon.apimgt.core.models.policy.SubscriptionPolicy;

import java.util.List;

/**
 * Provides access to Policy data layer
 */
public interface PolicyDAO {

    Policy getPolicy(String policyLevel, String policyName) throws APIMgtDAOException;

    List<Policy> getPolicies(String policyLevel) throws APIMgtDAOException;

    void addPolicy(String policyLevel, Policy policy) throws APIMgtDAOException;

    void deletePolicy(String policyName);

    /**
     * Retrieves Subscription Policy by UUID
     *
     * @param policyId  Subscription policy ID
     * @return {@link SubscriptionPolicy} of given UUID
     * @throws APIMgtDAOException   If failed to get subscription policy.
     */
    SubscriptionPolicy getSubscriptionPolicyById(String policyId) throws APIMgtDAOException;

    /**
     * Retrieves Application Policy by UUID
     *
     * @param policyId  Application policy ID
     * @return {@link ApplicationPolicy} of given UUID
     * @throws APIMgtDAOException   If failed to get application policy.
     */
    ApplicationPolicy getApplicationPolicyById(String policyId) throws APIMgtDAOException;


}
